<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Product list template
 *
 * @see Mage_Catalog_Block_Product_List
 */
?>
<script type="text/javascript" src="<?php echo $this->getSkinUrl('fancybox/jquery.fancybox-1.3.4.pack.js');?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('fancybox/jquery.fancybox-1.3.4.css');?>" media="screen" />
<script type="text/javascript" src="<?php echo $this->getSkinUrl('fancybox/fancybox.setting.js');?>"></script>
<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>

<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<?php echo $this->getToolbarHtml() ?>
<div class="category-products">
  <?php // List mode ?>
  <?php if($this->getMode()!='grid'): ?>
  <?php $_iterator = 0; ?>
  <ol class="products-list" id="products-list">
    <?php foreach ($_productCollection as $_product): ?>
    <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
      <?php if( Mage::getModel('newproduct/grid')->isNewProduct($_product->getId()) ): ?>
      <div class="products-new">New</div>
      <?php endif; ?>
      <div class="col2-top"></div>
      <div class="col2-mid">
        <?php // Product Image ?>
        <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(200); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
        <?php // Product description ?>
        <div class="product-shop">
          <div class="f-fix">
            <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
            <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
            <?php if($_product->getRatingSummary()): ?>
            <?php echo $this->getReviewsSummaryHtml($_product) ?>
            <?php endif; ?>
            <?php echo $this->getPriceHtml($_product, true) ?>
            <?php if($_product->isSaleable()): ?>
            <p>
              <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
            </p>
            <?php else: ?>
            <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
            <?php endif; ?>
            <div class="desc std"> <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a> </div>
            <div class="add-to-links">
              <?php if ($this->helper('wishlist')->isAllow()) : ?>
              <a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>
              <?php endif; ?>
              <span class="separator">|</span>
              <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
              <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a>
              <?php endif; ?>
            </div>
          </div>
        </div>
        <div class="clear"></div>
      </div>
      <div class="col2-btm"></div>
    </li>
    <?php endforeach; ?>
  </ol>
  <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
  <?php else: ?>
  <?php // Grid Mode ?>
  <?php $_collectionSize = $_productCollection->count() ?>
  <?php $_columnCount = 100 //$this->getColumnCount(); ?>
  <?php $i=0; foreach ($_productCollection as $_product): ?>
  <?php if ($i++%$_columnCount==0): ?>
  <ul class="products-grid row">
    <?php endif ?>
    <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?> span3">
    <div class="products-box">
      <?php if( Mage::getModel('newproduct/grid')->isNewProduct($_product->getId()) ): ?>
      <div class="products-new">New</div>
      <?php endif; ?>
      <?php if( Mage::getModel('featuredproduct/grid')->isFeaturedProduct($_product->getId()) ): ?>
      <div class="featured-product">Sale</div>
	  <?php endif; ?>
      <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(500,500); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
      <a href="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(600,600); ?>" class="category_image" title="<?php echo $this->__('Enlarge') ?>" rel="tooltip">&nbsp;</a>
      <div class="shadow-s">&nbsp;</div>
      <div class="pro-info">
        <?php if($_product->getRatingSummary()): ?>
        <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
        <?php endif; ?>
        <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
        <?php /*?><div class="desc std"><?php if ($_product->getData('short_description')): ?>
				<?php echo substr($_product->getResource()->getAttribute('short_description')->getFrontend()->getValue($_product),0,88), '...' ?><?php endif ?> </div><?php */?>
      </div>
      <?php echo $this->getPriceHtml($_product, true) ?>
      <div class="actions">
          <?php if($_product->isSaleable()): ?>
          <button type="button" rel="tooltip" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
          <?php else: ?>
          <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
          <?php endif; ?>
          <ul class="add-to-links">
              <?php if ($this->helper('wishlist')->isAllow()) : ?>
              <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" rel="tooltip" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('&nbsp;') ?></a></li>
              <?php endif; ?>
              <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
              <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" rel="tooltip" class="link-compare" title="<?php echo $this->__('Add to Compare') ?>"><?php echo $this->__('&nbsp;') ?></a></li>
              <?php endif; ?>
            </ul>
            </div><div class="clear"></div>
        </div>
  </li>
    <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
  </ul>
  <?php endif ?>
  <?php endforeach ?>
  <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
  <?php endif; ?>
</div>
<div class="toolbar-bottom"> <?php echo $this->getToolbarHtml() ?> </div>
<?php endif; ?>
